package com.example.androidhive;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Calendar;

import android.R;
import android.app.Service;
import android.content.Intent;
import android.media.MediaCodec;
import android.media.MediaFormat;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;


public class Serw extends Service {
	private static final String TAG = "MyService";
	MediaPlayer player;
	
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
	
	@Override
	public void onCreate() {
		Toast.makeText(this, "My Service Created", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onCreate");
				
	}
	@Override
	public void onDestroy() {
		Toast.makeText(this, "My Service Stopped", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onDestroy");
	//	player.stop();
	}
	
	@Override
	public void onStart(Intent intent, int startid) {
		Toast.makeText(this, "My Service Started", Toast.LENGTH_LONG).show();
		Log.d(TAG, "onStart");new MM().start();
		/* int key = intent.getIntExtra("key", 0);
		    MediaPlayer mMediaPlayer = new MediaPlayer();

		    FileInputStream fileStream = null;
		    try {
		    	
		        fileStream = new FileInputStream("/sdcard/my_sounds/TEST.mp3");
		    } catch (FileNotFoundException e1) {
		        e1.printStackTrace();
		    }

		    try {
		        mMediaPlayer.setDataSource(fileStream.getFD());
		    } catch (IllegalArgumentException e) {
		        e.printStackTrace();
		    } catch (IllegalStateException e) {
		        e.printStackTrace();
		    } catch (IOException e) {
		        e.printStackTrace();
		    }

		    try {
		        mMediaPlayer.prepare();
		    } catch (IllegalStateException e) {
		        e.printStackTrace();
		    } catch (IOException e) {
		        e.printStackTrace();
		    }
		player.start();*/
	}


}
